<?php

header ('Content-type: text/html; charset=UTF-8'); 


?>

<script src="system.js"></script>


<script language="javascript" type="text/javascript">


					
	function submitbutton(pressbutton) 
	{
		//var form = document.adminForm;
	
		switch( pressbutton )
		{
			
			case	"send":
			{
				
					
					var oObject = {} ;
					
					oObject["email"] = username;//getInputValueElementId( "email" );
					oObject["password"] = getInputValueElementId( "password" );
					oObject["component"] = "authentication";
					oObject["controller"] = "user";
					oObject["task"] = "newpassword";
					
					
					var jsonVales	=	convertToJSON(oObject);
					
					parameters	=	'parameters='+encodeURIComponent(
											convertToStringJSON(jsonVales));
					
					var method='PUT';
						
					httpRequest ( method,
									url_API,
									parameters,
									'returnSetNewPassword');

						
					return false;
				
				
			}break;
			default:
			{
				
			}
		}	
		
	}

function returnSetNewPassword( jsonObj){
	
	if( jsonObj.status == 1){
		
		//if(jsonObj.notification == 1)
		alert( jsonObj.data );
		window.location.href='home_authenticated.php';
		//else
		//	alert( "data: "+jsonObj.data );
			
	}else{
		alert( "Alerta: "+ jsonObj.data );
	}
	
}

</script>

</script>

<h1>Mudar senha</h1>
Area restria aos usuarios autenticados. voce esta logado como <div id="username-id"></div>.<a href="#" onclick="javascript:logout();">Clique aqui para Logout</a>


<div id="text-result-hidden" style="visibility:hidden;width:1px;height:1px;"></div>
<div id="text-result-hidden-username" style="visibility:hidden;width:1px;height:1px;"></div>

<div id="text-result"></div>
 
<br>

<form class="cmxform" action="" method="GET">
	<input type="hidden" name="parameters" id="parameters" value=''>	


	<div id="label">senha</div> <div id="field"><input type="password" id="password" name="password"/></div>
	
	<input type="button" name="enviar" value="salvar" onclick="javascript:submitbutton('send');"/>
	
</form>


<br>


<a href="home_authenticated.php">Página inicial</a><br>



<script>

	getUsername();

</script>